﻿<%@ Page Title="Manage User" Language="C#" MasterPageFile="~/Administration/Site.Master" AutoEventWireup="true" CodeBehind="AddUser.aspx.cs" Inherits="AdministrationWeb.Administration.WebForm2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="headerText" runat="server">
    <asp:Label ID="lblPageName" runat="server"></asp:Label>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <table>
        <tr>
            <td>
                User Name:
            </td>
            <td>
                <asp:TextBox ID="txtUserName" runat="server" Width="300px" /><br/>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                            ControlToValidate="txtUserName" ErrorMessage="User Name Required" 
                                            ValidationGroup="submit" Display="Dynamic" ForeColor="RED"  />
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                                ControlToValidate="txtUserName" Display="Dynamic" ErrorMessage="Username must be 4 or more characters" 
                                                ValidationExpression="^([A-Za-z0-9]{4})+(.*)" ValidationGroup="submit" ForeColor="RED" />
            </td>
        </tr>
        <tr>
            <td>
                Permission:
            </td>
            <td>
                <asp:DropDownList ID="ddlPermission" runat="server" DataSourceID="SqlUserInfo" DataTextField="permission_text" DataValueField="permission_id">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
                First Name:
            </td>
            <td>
                <asp:TextBox ID="txtFirstName" runat="server" Width="300" /><br />
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtFirstName" ErrorMessage="First Name Required" 
                    ValidationGroup="submit" ForeColor="RED" Display="Dynamic" />
            </td>
        </tr>
        <tr>
            <td>
                Last Name:
            </td>
            <td>
                <asp:TextBox ID="txtLastName" runat="server" Width="300" /><br/>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtLastName" ErrorMessage="Last Name Required" 
                    ValidationGroup="submit" ForeColor="RED" Display="Dynamic"  />
            </td>
        </tr>
        <tr>
            <td>
                Email Address:
            </td>
            <td>
                <asp:TextBox ID="txtEmailAddress" runat="server" Width="300" /><br/>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                                            ControlToValidate="txtEmailAddress" ErrorMessage="Email Address Required" 
                                            ValidationGroup="submit" Display="Dynamic" ForeColor="RED" />
                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                                                ControlToValidate="txtEmailAddress" Display="Dynamic" 
                                                ErrorMessage="improper email format" ValidationExpression=".*@.*\..*" 
                                                ValidationGroup="submit" ForeColor="RED" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lblGradYear" runat="server" Text="Graduation Year:" />
            </td>
            <td>
                <asp:TextBox ID="txtGradYear" runat="server" Width="300" /><br/>
                <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="txtGradYear" ErrorMessage="Graduation Year Must Be a Number" 
                    ValidationGroup="submit" Type="Integer" Operator="DataTypeCheck" ForeColor="RED" Display="Dynamic"  />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lblPassword" runat="server" Text="Password" />
            </td>
            <td>
                <asp:TextBox ID="txtPassword" runat="server" Width="300" TextMode="Password" /><br />
                <asp:RequiredFieldValidator ID="rqvPassword" runat="server" ControlToValidate="txtPassword" ErrorMessage="Password Required" ValidationGroup="submit" 
                    ForeColor="RED" Display="Dynamic" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:TextBox ID="txtUserId" runat="server" Visible="False"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td colspan="2" class="submitButtons">
                <asp:Button ID="btnSubmit" runat="server" Text="Submit" ValidationGroup="submit" OnClick="btnSubmit_Click" CssClass="button" />
                <asp:Button ID="btnCancel" runat="server" CausesValidation="False" OnClick="btnCancel_Click" Text="Cancel" CssClass="button" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Label ID="lblMessage" runat="server" Text="Label" Visible="False"></asp:Label>
            </td>
        </tr>
    </table>
    <asp:SqlDataSource ID="SqlUserInfo" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationConnectionString %>" ProviderName="<%$ ConnectionStrings:ApplicationConnectionString.ProviderName %>"
        SelectCommand="select permission_id, permission_text from lkup_permission"></asp:SqlDataSource>
</asp:Content>
